package com.zoweunion.mechanic.dao.app;

import com.zoweunion.mechanic.model.app.AssignRegion;
import com.zoweunion.mechanic.model.app.Region;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

@Mapper
@Component
public interface AppDao {

	public Map<String, Object> findUserByCar(Map<String, Object> reqMap);

	public int createOrder(Map<String, Object> reqMap);

	public int createOrderFault(Map<String, Object> reqMap);

	public int createOrderDetail(Map<String, Object> reqMap);

	public int creatOrderImg(Map<String, Object> imgMap);

	public int repairLocationRecord(Map<String, Object> imgMap);

	public List<Map<String, Object>> findFaultInfo(Map<String, Object> reqMap);

	public List<Map<String, Object>> findPartsByUpkeep(Map<String, Object> reqMap);

	public List<Map<String, Object>> findUpkeepInfo(Map<String, Object> reqMap);

	public int countOrderInfo(Map<String, Object> reqMap);

	public List<Map<String, Object>> listOrderInfo(Map<String, Object> reqMap);

	public List<Map<String, Object>> getReworkOrderMap(Map<String, Object> reqMap);

	/**
	 * 更新工单接口
	 * @param reqMap
	 * @return
	 */
	public int updateOrderInfo(Map<String, Object> reqMap);

	public int updateOrderAsStatus(Map<String, Object> reqMap);

	public int updateOrderStatus(Map<String, Object> reqMap);

	public int updateOrderDetail(Map<String, Object> reqMap);

	public int updateRepairman(Map<String, Object> repairmanMap);

	public int createRepairman(Map<String, Object> repairmanMap);

	public int createTimeoutPush(Map<String, Object> repairmanMap);

	public int createOrderParts(Map<String, Object> orderPartsMap);

	public int updateUserForAmount(Map<String, Object> userInfoMap);

	double getRemainingNum(Map<String, Object> reqMap);

	public List<Map<String, Object>>findOrderImg(Map<String, Object> reqMap);

	public Map<String, Object> findCarInfoById(Map<String, Object> reqMap);

	Map<String, Object> findCarById(Map<String, Object> reqMap);

	public Map<String, Object> findUpkeepInfoById(Map<String, Object> orderMap);

	public List<Map<String, Object>> findUpkeepDetailById(Map<String, Object> upkeepMap);

	public List<Map<String, Object>> findOrderDetailById(Map<String, Object> orderMap);

	public int updateOrderTimeoutPush(Map<String, Object> orderMap);

	public List<Map<String, Object>> findOrderFaultById(Map<String, Object> orderMap);

	public List<Map<String, Object>> findOrderRepairmanById(Map<String, Object> orderMap);

	public List<Map<String, Object>> findOrderPartsByIdForOld(Map<String, Object> orderMap);

    public List<Map<String, Object>> findOrderPartsByIdForOrigin(Map<String, Object> orderMap);

	public List<Map<String, Object>> findOrderPartsByIdForNew(Map<String, Object> orderMap);

	public List<Map<String, Object>> findOrderPartsByIdForChange(Map<String, Object> orderMap);

	public int removeOwnerDriver(Map<String, Object> reqMap);

	public int removeUserByDriver(Map<String, Object> reqMap);

	public Map<String, Object> lastCarHumanFace(Map<String, Object> reqMap);

	public Map<String, Object> getHumanCommand (Map<String, Object> reqMap);
	/**
	 * 查询车辆信息
	 *
	 * @param reqMap
	 * @return
	 */
	public List<Map<String, Object>> findOwnerCarInfo(Map<String, Object> reqMap);

	/**
	 * 获取车辆列表
	 *
	 * @param reqMap
	 * @return
	 */
	public List<Map<String, Object>> getVehicleList(Map<String, Object> reqMap);

	public Map<String, Object> findServiceById(Map<String, Object> reqMap);

	public String selectPassWord(@Param("userId") String userId);

	public int updatePassword(Map<String, Object> reqMap);

	public int updateUserInfo(Map<String, Object> reqMap);

	public int addOwnerDriver(Map<String, Object> reqMap);

	public int addUser(Map<String, Object> reqMap);

	public int removeDriver(String c_id);

	public int addDriver(Map<String, Object> reqMap);

	public List<Map<String, Object>> findUserById(Map<String, Object> reqMap);

    public Map<String, Object> findDriverByAccount(Map<String, Object> reqMap);

	public int selectDriver(Map<String, Object> reqMap);

	public int createDriver(Map<String, Object> reqMap);

	public int updateOwnerCar(Map<String, Object> reqMap);

	int existOwnerCar(Map<String, Object> reqMap);

	public List<Map<String, Object>>findOwnerDriver(Map<String, Object> reqMap);

	public Map<String, Object> findOwnerDriverById(Map<String, Object> driverMap);

	public List<Map<String, Object>>findCarByDriver(Map<String, Object> reqMap);

	public List<Map<String, String>> selectPassWord1();

	public void updateToMd5(@Param("id") String id, @Param("user_password") String user_password);

	public void updateHumanFaceAuthorization(Map<String, Object> reqMap);

	LinkedList<Map<String, Object>> getOrderListByPayType(Map<String, Object> reqMap);

	public Map<String, Object> findOrderInfoById(Map<String, Object> reqMap);

	public HashMap<String, Object> getOrderInfoById(@Param("orderId") String orderId);

	public List<Map<String, Object>> listCarDriverInfo(Map<String, Object> reqMap);

	// 获取服务商管理员
	List<Map<String, String>> getGuanliyuanMapList(Map<String, Object> reqMap);

	List<Map<String,Object>> findUserByRid(Map<String, Object> reqMap);

	List<Map<String,Object>> findUserRoleByRid(Map<String, Object> reqMap);

	List<Map<String, Object>> getAreaAll();

	List<Map<String, Object>> getCityAll();

	List<Region> getRegionIncludeProvinceAll();

	List<Region> getRegionIncludeProvinceAllAngular();

	List<Map<String, Object>> getProvinceByNumber(Map<String, Object> reqMap);

	List<Map<String, Object>> getCityByNumber(Map<String, Object> reqMap);

	List<Map<String, Object>> getAreaByNumber(Map<String, Object> reqMap);

	List<Map<String, Object>> getProvinceAll();

	List<Map<String, Object>> findCarInfo(Map<String, Object> reqMap);

	List<Map<String, Object>> findUserByRAreaName(Map<String, Object> reqMap);

	List<Map<String, Object>> findUserByRAreaCode(Map<String, Object> reqMap);

	List<Map<String, Object>> findOrderInfoByCId(Map<String, Object> reqMap);

	List<Map<String, Object>> findMessageBySId(Map<String, Object> reqMap);

	int updateMessage(Map<String, Object> reqMap);

	int getMessageFlagCount(Map<String, Object> reqMap);

	int addEvaluate(Map<String, Object> reqMap);

	int addEvaluateImg(Map<String, Object> reqMap);

	Double getTotalScore(Map<String, Object> reqMap);

	int updateShopInfoTotalScore(Map<String, Object> reqMap);

	int updateBuyInfoTotalScore(Map<String, Object> reqMap);

	List<Map<String, Object>> getEvaluate(Map<String, Object> reqMap);

	List<Map<String, Object>> getEvaluateImg(@Param("ids") List<String> ids);

	int getEvaluateCount(Map<String, Object> reqMap);

	List<Double> getEvaluateScore(Map<String, Object> reqMap);

	/**
	 * 修改上一次登陆的地址
	 * @param reqMap
	 * @return
	 */
	int updateLastCity(Map<String, Object> reqMap);

	/**
	 * 获取上一次登陆的地址
	 * @param reqMap
	 * @return
	 */
	Map<String, Object> getLastCity(Map<String, Object> reqMap);

	/**
	 * 删除用户下所有的历史搜索指标记录
	 * @param reqMap
	 * @return
	 */
	int deleteHistorySearchTarget(Map<String, Object> reqMap);

	/**
	 * 新增历史搜索指标记录
	 * @param reqMap
	 * @return
	 */
	int addHistorySearchTarget(Map<String, Object> reqMap);

	/**
	 * 根据指标查询历史搜索指标记录
	 * @param reqMap
	 * @return
	 */
	int getHistorySearchByTarget(Map<String, Object> reqMap);

	/**
	 * 获取历史搜索指标记录
	 * @param reqMap
	 * @return
	 */
	List<Map<String, Object>> getHistorySearchTarget(Map<String, Object> reqMap);

	/**
	 * 获取物联网卡数据
	 * @param reMap
	 * @return
	 */
	List<Map<String, Object>> getThingsList(Map<String, Object> reMap);

	/**
	 *插入新的物联网卡
	 * @param reMap
	 * @return
	 */
	int insertNewThings(Map<String, Object> reMap);

	/**
	 * 模糊匹配 获取服务商
	 * @param reMap
	 * @return
	 */
	List<Map<String, Object>> getServer(Map<String, Object> reMap);

	List<Map<String, String>> selectAreaNumberAssignRegionFacilitatorBySId(@Param("sId") String sId);

	String getWarehouseIdByUserId(@Param("userId") String userId);

	/**
	 * 获取服务商管辖区域排除所有销售的管辖区域，
	 * @param sId
	 * @return
	 */
	List<Map<String, String>> selectAreaNumberAssignRegionExcludeAllSalesBySId(@Param("sId") String sId,@Param("id") String id);



	/**
	 * 插入负责区域
	 * @param assignRegionList
	 * @return
	 */
	int insertAssignRegion(@Param("assignRegionList") List<AssignRegion> assignRegionList);

	/**
	 * 移除用户的所有负责区域
	 * @param sId
	 * @return
	 */
	int removeAssignRegionUserBySId(@Param("sId") String sId, @Param("userId") String userId);
	/**
	 * 获取员工的所有负责区域编号，字符串拼接形式
	 * @param sId
	 * @return
	 */
	List<Map<String, String>> selectAreaNumberAssignRegionUserBySId(@Param("sId") String sId, @Param("userId") String userId);

	/**
	 * 查询 员工的所有负责区域
	 * @param sId
	 * @param userId
	 * @return
	 */
	List<AssignRegion> selectAssignRegionUserBySId(@Param("sId") String sId, @Param("userId") String userId);

	int deleteAssignRegionByUserId(@Param("userId") String userId);

	Map<String, Object> getRegionAddressByAreaNumber(@Param("area") String area);

	int addCarAddress(Map<String, Object> reMap);

	Map<String, Object> getUpdateUserMap(Map<String, Object> reqMap);

    List<Map<String, Object>> getLockInfo(Map<String, Object> reqMap);

    int updateLockInfo(Map<String, Object> reqMap);

    Map<String, Object> getAuthByGYId(@Param("currentUserId") String currentUserId, @Param("sId") String sId);

    int saveUserTrid(Map<String, Object> reqMap);

    Map<String, Object> getUserTrid(Map<String, Object> reqMap);

    // 获取修工到达距离时间
    Map<String, Object> findRepairLocationRecord(Map<String, Object> reqMap);

    List<Map<String, Object>> findUpkeepInfoByModelId(Map<String, Object> reqMap);

    List<Map<String, Object>> selectTemplateColumn();

	List<Map<String, Object>> selectFaultData(Map<String, Object> reqMap);

    void trialApplication(Map<String, Object> reqMap);

	Map<String, Object> getAppPcSetting(String appName);

	void createOwnerDriver(Map<String, Object> reqMap);

	List<Map<String, Object>> findOwnerDriverNew(Map<String, Object> reqMap);

	int removeOwnerDriverRelation(Map<String, Object> reqMap);

    List<Map<String, Object>> getAllCarInFinancialByOwnerId(String o_id);

	int applyUnlock(Map<String, Object> params);

	String selectFinanceIdBySid(Map<String, Object> params);

	String getFinanceManageIdBySid(@Param("s_id") String sID);

	Map<String, Object> getCarInfoById(@Param("c_id")String c_id);
}
